// 实时巡检
import httpAPI from '../../utils/http.js'

export default {
  /**
   * 发起实时检
   * @param {Object} params
   */
  initiate (params) {
    console.log(params)
    if (params.id) {
      return httpAPI.post('system/patrolreal/edit', params)
    } else {
      return httpAPI.post('system/patrolreal/save', params)
    }
  },
  /**
   * 我发起的
   * @param {Object} params
   */
  getMyInitiate(params) {
    return httpAPI.get('system/patrolreal/mylaunch', params)
  },
  /**
   * 我整改的/抄送我的
   */
  getAboutMy(params) {
    return httpAPI.get('system/patrolreal/mytask',params)
  },
  /**
   * 问题列表
   */
  getQuistionsList() {
    return httpAPI.get('/system/patrolreal/category')
  },
  /**
   * 获取实时检详情
   * @param {Object} id 实时检id
   */
  getRealDetails(id) {
    return httpAPI.get('system/patrolreal/' + id)
  },
  /**
   * 整改详情
   * @param {Object} id 整改id
   */
  getAbarbeitungDetails(id) {
    return httpAPI.get(`system/patrolrecord/myreform/${id}`)
  },
  /**
   * 查询负责人通讯录
   */
  getHeadAddress() {
    return httpAPI.get('system/workbench/findReContacts')
  },
  /**
   * 通过姓名查询负责人通讯录
   */
  getHeadAddressByName(params) {
    return httpAPI.get('/system/workbench/findReContactByName', params)
  },
  /**
   * 查询抄送人通讯录
   */
  getCPeople() {
    return httpAPI.get('system/workbench/findContactsCc')
  },
  /**
   * 实时检类别统计
   * @param {Object} projectId 项目id
   */
  getRealTimeStatistical(projectId) {
    return httpAPI.get(`system/patrolreal/${projectId}/categoryDetailReport`)
  },
  /**
   * 查询今日统计
   * @param {Object} projectId 项目id
   */
  getRealTimeToday(projectId) {
    return httpAPI.get(`system/patrolreal/${projectId}/todayReport`)
  },
  /**
   * 撤销实时检
   * @param {Object} id 撤销id
   */
  onRevocation(id) {
    return httpAPI.post('system/patrolreal/revocation', {
      id
    })
  }
}
